package com.woniuxy.third.configuration;

import com.woniuxy.third.interceptor.PermsInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import javax.annotation.Resource;

/**
 * @Author: yangtao
 * @date 2021/7/14 14:32
 * @Version 1.0
 */
@Configuration
public class InterceptorConfiguration implements WebMvcConfigurer {
    @Resource
    private PermsInterceptor permsInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        //注册自己的拦截器，并指定拦截哪些请求，此处是拦截所有请求
        registry.addInterceptor(permsInterceptor).addPathPatterns("/**");
    }
}

















